package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.ProvinceQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.ProvinceDao;
import com.bbdjt.weixin.model.Province;
import com.bbdjt.weixin.service.ProvinceService;

@Service("provinceService")
public class ProvinceServiceImpl extends BaseServiceImpl<Province> implements ProvinceService {
	
	@Override
    public List<Province> selectByProvince(Province province, int page, int rows) {
        Example example = new Example(Province.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(province);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Province> selectByProvince(Province province) {
        Example example = new Example(Province.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(province);
        return selectByExample(example);
    }

    @Override
    public PageInfo<ProvinceQueryModel> selectByProvinceQueryModel(ProvinceQueryModel province) {
    	return ((ProvinceDao) getMapper()).selectByProvinceModel(province);
    }

	@Override
	public List<Province> selectByProvince(ProvinceQueryModel province) {
		  Example example = new Example(Province.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(province);
	        PageHelper.startPage(province.getPageNum(), province.getPageSize(),province.getOrderBy());
	        return selectByExample(example);
	}

	
}